 
# Makefile
# Author : Edouard ROGE

CC=g++
AR=ar -rcs
CFLAGS= -Wall -Wextra -std=c++11 -fPIC -DGUI_LINUX_EXPORTS
GTKFLAGS=`pkg-config --cflags --libs gtkmm-3.0`
LDFLAGS= -shared  
LIBS=-L/usr/local/lib -L../../lib -lcore
INCLUDES=-I..

PROJECT=GUI
NAME=GUI
SRC_DIR=./
OBJ_DIR=../../obj/$(PROJECT)
LIB_DIR=../../lib
INC_DIR=../../include/$(PROJECT)
BIN_DIR=../../bin

SRC_FILES=	Linux/GUIContext.cpp \
			Linux/GUIPlugin.cpp \
			Linux/Application/Application.cpp \
			Linux/Application/Window.cpp \
			Linux/Button/Button.cpp \
			Linux/Layout/VerticalLayout.cpp \
			Linux/Layout/HorizontalLayout.cpp \
			
HDR_FILES=$(addprefix $(SRC_DIR)/, $(SRC_FILES:.cpp=.h))
OBJ_FILES=$(addprefix $(OBJ_DIR)/, $(SRC_FILES:.cpp=.o))

TARGET=$(BIN_DIR)/$(NAME).so

release: CFLAGS += -O3
release:$(TARGET)
debug: CFLAGS += -DDEBUG -g
debug:$(TARGET)
all:$(TARGET)

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
	@echo -n "Compiling `basename $<` : "
	@$(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@ $(GTKFLAGS)
	@cp $(<:.cpp=.h) $(INC_DIR)/$(dir $<)
	@echo "OK"

$(TARGET):$(OBJ_FILES)
	@echo -n "Creating `basename $@` : "
	@$(CC) $(OBJ_FILES) -o $(TARGET) $(LDFLAGS) $(LIBS) $(GTKFLAGS)
	@echo "OK"

clean:
	@echo -n "$(PROJECT) : Deleting .o and library: "
	@rm -f $(OBJ_FILES)
	@rm -f $(TARGET)
	@echo "OK"
